﻿# CMakeList.txt: 顶层 CMake 项目文件，在此处执行全局配置
# 并包含子项目。
#

cmake_minimum_required(VERSION 3.10...3.21)

# ---------------------------------------------------------------------------------------
# Set environment variable  
# ---------------------------------------------------------------------------------------
#set(ENV{TOP_APPLICATION_DIR} "CameraWithEMMC")
#set(ENV{TOP_APPLICATION_NAME} "$ENV{TOP_APPLICATION_DIR}")

# ---------------------------------------------------------------------------------------
# Set Project variable  
# ---------------------------------------------------------------------------------------
set(APP1_NAME "CameraWithEMMC")
set(APP1_PATH "${APP1_NAME}")
set(APP2_NAME "app2")
set(APP2_PATH "${APP2_NAME}")

# ---------------------------------------------------------------------------------------
# Start spdlog project
# ---------------------------------------------------------------------------------------
include(cmake/utils.cmake)
#include(cmake/ide.cmake)

# 读取版本号

# 设置项目的名字，版本，语言
project ("Camera002" ${APP_VERSION} LANGUAGES CXX)

# 读取系统cmake文件，系统默认安装路径
include(GNUInstallDirs)



# ---------------------------------------------------------------------------------------
# Set default build to release
# ---------------------------------------------------------------------------------------
if(NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose Release or Debug" FORCE)
endif()

# ---------------------------------------------------------------------------------------
# Compiler config
# ---------------------------------------------------------------------------------------
if(NOT CMAKE_CXX_STANDARD)
    set(CMAKE_CXX_STANDARD 11)
    set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()

# make sure __cplusplus is defined when using msvc and enable parallel build
if(MSVC)
    string(APPEND CMAKE_CXX_FLAGS " /Zc:__cplusplus /MP")
endif()

set(CMAKE_CXX_EXTENSIONS OFF)

if(CMAKE_SYSTEM_NAME MATCHES "CYGWIN" OR CMAKE_SYSTEM_NAME MATCHES "MSYS")
    set(CMAKE_CXX_EXTENSIONS ON)
endif()


# ---------------------------------------------------------------------------------------
# add application  
# ---------------------------------------------------------------------------------------
add_subdirectory ("${APP1_PATH}")
add_subdirectory ("${APP2_PATH}")
